package gt.edu.usac.viewcontroller;

import gt.edu.usac.viewcontroller.utils.ADFUtils;

import java.util.List;
import javax.faces.event.ValueChangeEvent;
public class ShuttlePageBackingBeanBase {
    String allItemsIteratorName;
    String allItemsValueAttrName;
    String allItemsDisplayAttrName;
    String allItemsDescriptionAttrName;
    String selectedValuesIteratorName;
    String selectedValuesValueAttrName;
    List selectedValues;
    List allItems;
    private boolean refreshSelectedList = false;
    
    public List getSelectedValues() {
      if (selectedValues == null || refreshSelectedList) {
        selectedValues = ADFUtils.
         attributeListForIterator(selectedValuesIteratorName,
                                  selectedValuesValueAttrName);
      }
      return selectedValues;
    }
    
    public List getAllItems() {
      if (allItems == null) {
         allItems = ADFUtils.selectItemsForIterator(allItemsIteratorName, 
                                                    allItemsValueAttrName,
                                                    allItemsDisplayAttrName,
                                                    allItemsDescriptionAttrName);
      }
      return allItems;
    }  
    
    public void setAllItemsIteratorName(String allItemsIteratorName) {
        this.allItemsIteratorName = allItemsIteratorName;
    }

    public String getAllItemsIteratorName() {
        return allItemsIteratorName;
    }

    public void setAllItemsValueAttrName(String allItemsValueAttrName) {
        this.allItemsValueAttrName = allItemsValueAttrName;
    }

    public String getAllItemsValueAttrName() {
        return allItemsValueAttrName;
    }

    public void setAllItemsDisplayAttrName(String allItemsDisplayAttrName) {
        this.allItemsDisplayAttrName = allItemsDisplayAttrName;
    }

    public String getAllItemsDisplayAttrName() {
        return allItemsDisplayAttrName;
    }

    public void setAllItemsDescriptionAttrName(String allItemsDescriptionAttrName) {
        this.allItemsDescriptionAttrName = allItemsDescriptionAttrName;
    }

    public String getAllItemsDescriptionAttrName() {
        return allItemsDescriptionAttrName;
    }

    public void setSelectedValuesIteratorName(String selectedValuesIteratorName) {
        this.selectedValuesIteratorName = selectedValuesIteratorName;
    }

    public String getSelectedValuesIteratorName() {
        return selectedValuesIteratorName;
    }

    public void setSelectedValuesValueAttrName(String selectedValuesValueAttrName) {
        this.selectedValuesValueAttrName = selectedValuesValueAttrName;
    }

    public String getSelectedValuesValueAttrName() {
        return selectedValuesValueAttrName;
    }

    public void setSelectedValues(List selectedValues) {
        this.selectedValues = selectedValues;
    }

    public void setAllItems(List allItems) {
        this.allItems = allItems;
    }

    public void setRefreshSelectedList(boolean refreshSelectedList) {
        this.refreshSelectedList = refreshSelectedList;
    }

    public boolean isRefreshSelectedList() {
        return refreshSelectedList;
    }
}

